<template>
  <Modal v-model="modal" :title="title">
    <div class="tag-modal">
      <!-- 除登录等等 -->
      <img  v-if="path !== '0'" :src="src" alt="">
      <Timeline v-else>
          <TimelineItem>
              <p class="time">特别说明</p>
              <p class="content">为了保证版型数据的安全性，电脑端主要用于版型文件的上传与下载。小程序将会对文件下载进行授权验证，同时所有的下载将记录下载IP地址及其它电脑信息。版型的沟通请使用小程序的消息功能。</p>
          </TimelineItem>
          <TimelineItem>
              <!-- <p class="time">1984年</p> -->
              <p class="content">1.在电脑端打开浏览器，建议使用谷歌浏览器。</p>
          </TimelineItem>
          <TimelineItem>
              <!-- <p class="time">2007年</p> -->
              <p class="content">2.在地址栏输入（点击可复制网址）:<span>http://www.yybxk.net/client</span>;<Button @click="toCopy" size="small" type="primary">复制</Button></p>
          </TimelineItem>
          <!-- <TimelineItem>
              <p class="time">3.点击下方扫码按钮，扫码登录；</p>
              <p class="content">发布 iPad</p>
          </TimelineItem> -->
      </Timeline>
    </div>
    <div slot="footer">
      <Button @click="modal = false" size="large" type="text">取消</Button>
      <!-- <Button :loading='btnLoading' @click="onSave" type="primary" size="large">确定</Button> -->
    </div>
  </Modal>
</template>
<script>
export default {
  data() {
    return {
      modal: false,
      title: "详情",
      path: '0',
      src: '',
      url: 'http://www.yybxk.net/client'
    };
  },
  methods: {
    openModal(path) {
      this.path = path
      let src =  ''
      if (this.path == 1)  src = require('@/assets/images/yygs/fwzx_0.png')
      if (this.path == 2)  src = require('@/assets/images/yygs/dzfw_0.png')
      if (this.path == 3)  src = require('@/assets/images/yygs/cjwt_0.png')
      if (this.path == 4)  src = require('@/assets/images/yygs/gywm_0.png')
      if (this.path == 5)  src = require('@/assets/images/yygs/jmzs_0.png')
      this.src = src
      this.modal = true;
    },
    closeModal() {
      this.modal = false;
    },
    toCopy: function () {
        if (!this.url) {
            alert('请输入要复制的内容')
        } else {
            var copyInput = document.createElement('input')
            copyInput.setAttribute('value', this.url)
            document.body.appendChild(copyInput)
            copyInput.select()
            try {
                var copyed = document.execCommand('copy')
                if (copyed) {
                  document.body.removeChild(copyInput)
                  this.$Notice.success({
                    title:`复制成功`
                  })
                }
            } catch(res) {
                this.$Notice.error({
                  title:`'复制失败，请检查浏览器兼容`
                })
            }
        }
    }
  }
};
</script>

